pp108 : Creating an Action Template

Creating an Action Template

This topic describes the procedure to create and modify an action template.

An action template represents the draft of an action which can be reused. For example, if you have used aset discountaction in a rule, and want to use the same action in another rule, you need not build that action from scratch. Instead, you can pick an action template, fine-tune it to your specifications, and use it to build the rule.

You can either design actions that can be used directly by the users or accept parameters from users to form the complete action. The parameters preceded by a colon(:) are taken as variables and the users using this template in a decision table can specify the values to these parameters.

1. Select a starting point and click (Action Template) to open the action template editor. The Action Template editor appears.
2. From the Action Type list box, select the type of action the rule must perform. Based on the actions selected above, the fields in the Define action here pane below changes.

Action Type

Action

Trigger Business Process

Click next to Process Name and select the required <business process> from the Business Process dialog box.Alternatively, to select the business process, you can do the any of the following:

  • Select the required <business process> from the Workspace Documents (Explorer) and drag it to the Message box in the Action - Trigger Business Process pane.
  • Click (Quick Access Menu) on the action template editor tool bar, click (Insert) on the Quick Access Menu sidebar, and drag the required <business process> to the Action - Trigger Business Process pane in the editor.
    The name of the process is displayed in the Process Name field and the input message of the selected process is displayed in the Message box.

Invoke Web service

Click next to Method Name and select the required <Web service> from the Web service dialog box.Alternatively, to select the business process, you can do the any of the following:

  • Select the required <Web service> from the Workspace Documents (Explorer) and drag it to the Message box in the Action - Invoke Web service pane.
  • Click (Quick Access Menu) on the action template editor tool bar, click (Insert) on the Quick Access Menu sidebar, and drag the required <Web service> to the Action - Invoke Web service pane in the editor.
    The name of the Web service is displayed in the Method Name field and the request of the selected Web service is displayed in the Request box.

Send Notification

Provide the necessary details in the Define action here pane. Refer to steps 3 to 6 of Using Send Notification for information on the fields of Send Notification action. Click on the tool bar after completing the action.

Assign

Select the required <schema fragment> from the Workspace Documents (Explorer) and drag it to the Input Schema in the editor. Alternatively, click (Quick Access Menu) on the action template editor tool bar, click (Insert) on the Quick Access Menu sidebar, and drag the required <schema fragment> to the Input Schema in the editor. The attributes of the schema fragment are displayed in the Input Schema pane.

Abort

Type the message, that is to be displayed to the user when the transaction is aborted, in XML format.

For more information on the actions, refer to the specific Rule Actions.

3. To enable the user to select values for the parameter while defining the rule action, do the following:

  • Select the required parameter in the message and type the parameter name preceded by a colon(:) in the expression. For example, use prefix: for the Order parameter as shown in the sample code. While using this action template in a decision table, users can specify the values to these parameters.
    <GetOrderId xmlns="http://schemas.cordys.com/orders">:Order</GetOrderId>
    
  • Press tab or click anywhere outside the cell. The parameter details are displayed in the Parameter Details table.
  • Type the appropriate label for the parameter in the Description text box. This label is displayed to the user when designing the rule.
  • Select the type of parameters to be used, from the Parameter Type list box. The parameters are displayed in the Parameters pane.

4. Click on the toolbar, to view the prefix and namespace of the elements. A Namespaces property sheet appears, displaying the prefix and namespace of the elements.
5. Click , provide the name, description, and appropriate location for the action template in the Name, Description, and Location fields respectively in the Save Document dialog box that appears and click OK.

An action template is created. You can drag these action templates to the Action section of the decision table. When you use an action template for defining the action in a decision table, you can select values from the set of parameters that are set in the action template.

Related tasks

Creating XML Schema Fragments
Creating an Object Template
Building a Decision Table
Creating a Condition Template
Generating a Web Service Operation on a Decision Table
Testing Rules Using Rule Test Tool

Related reference

Rule Actions